<%@ page import="zjitc.util.JDBCUtil" %>
<%@ page import="javax.sql.DataSource" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/6/1
  Time: 15:47
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>动态表格</title>
    <script src="js/jquery-2.1.0.js"></script>
    <link rel="stylesheet" href="css/table.css" type="text/css">
    <style>
        .btn-submit{width:80%;border:none;margin-top:2px;outline:none;height:25px;font-size:12px;background-color:#7f6173;color:#fff;}

        a{font-size:12px;display:block;text-decoration: none;color:#fff;background:#c00;border-radius:3px;;

            line-height:25px;}
    </style>
</head>
<body>
<form style="margin-right: 500px" action="${pageContext.request.contextPath}/addUserServlet" method="post">
    <div style="margin-left: 500px">

        <input type="text" id="age" name="age" placeholder="请输入年龄"><br>
        <input type="text" id="name" name="name" placeholder="请输入姓名"><br>
        <input type="text" id="gender" name="gender" placeholder="请输入性别">
        <input type="submit" id="btn_add" value="添加">
    </div>
</form>
<table border="1px" cellpadding="0px" cellspacing="0px">
    <tr>
        <td colspan="4" class="head">
            <h1>用户管理系统</h1>
        </td>
    </tr>
    <tr>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${users}" var="user" varStatus="s">
        <script>
            alert(user.name);
        </script>
        <tr>
            <td>${user.name}</td>
            <td>${user.age}</td>
            <td>${user.sex}</td>
            <td class="head" width="100px">
                <a class="btn-submit" href="${pageContext.request.contextPath}/delUserServlet?name=${user.name}">删除</a>
                <a class="btn-submit" href="${pageContext.request.contextPath}/findUserServlet?name=${user.name}">修改</a>
            </td>
        </tr>
    </c:forEach>
</table>
<input style="margin-left: 600px;font-size: 30px;margin-top: 10px" type="button" onclick='location.href=("${pageContext.request.contextPath}/index.jsp")' value="退出" />

</body>
</html>